#include <stdio.h>
#include <string.h>
#include "iostream"
using namespace std;

bool credentialCheck(char name[], char pass[])
{
    if(strcmp(name, "sBob") == 0 && strcmp(pass, "iLikeYellow") == 0) {
        return true;
    }
    return false;
}

int main(int argc, char**argv)
{
    int loggedIn = 0;

    printf("RealBank eBanking\n");
    printf("A checking account that fits your schedule\n\n");
    
    while(!loggedIn) {
        int authenticated = 0;
        char cUsername[15], cPassword[15];
        puts("\nUsername: ");
        gets(cUsername);

        puts("\nPassword : ");
        gets(cPassword);
        
        if(credentialCheck(cUsername, cPassword)) {
            authenticated = 1;
        }
        
        if(authenticated) {
            loggedIn = 1;
            system("cls");
            printf("RealBank                                    Online Banking\n\n");
            printf("Welcome %s \n", cUsername);
            printf("----------------------------------------------------------\n");
            printf("Accounts Overview\n");
            printf("Transfer\n");
            printf("Interest\n");
            printf("Free Bill Payer\n");
            printf("Text Banking\n");
            printf("Customer Service\n");
            getchar();
            exit(0);
        } 
        else {
            system("cls");
            printf("Invalid username or/and password.\n");
            printf("Please re-enter the your username and password.\n");
            printf("-----------------------------------------------\n");
        }
    }
    return 0;
}
